/*
 * Copyright 2002-2007 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package nl.jteam.jsa.core;

/**
 * @author Uri Boness
 */
public interface MutableDocument extends Document {

    /**
     * Adds the given field to this document. If the document already holds a field with the same name as the given one
     * the given field is then merged with the existing one (see {@link Field#merge(Field)}).
     *
     * @param field The field to be added to this document.
     */
    void addField(Field field);

    /**
     * Adds the given field values to this document. If this document does not hold a field that is associated with the
     * given field name, a new field will be created and added to this document with a default boost
     * (see {@link Boostable#DEFAULT_BOOST}).
     *
     * @param name The name of the field.
     * @param values The values of the field.
     */
    void addField(String name, Object... values);

    /**
     * Adds the given field values to this document and associates it with the given boost. If this document does not
     * already hold a field with the same name as the given one, a new field will be created and added to this document,
     * otherwise the values and boost will be merged with the existing field.
     *
     * @param name The name of the field.
     * @param values The values of the field.
     * @param boost The boost factor of the field.
     */
    void addField(String name, float boost, Object... values);

}
